<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRepairBillsTable extends Migration
{
  /**
   * 车辆维修单
   * Run the migrations.
   *
   * @return void
   */
  public function up()
  {
    Schema::create('repair_bills', function (Blueprint $table) {
      $table->increments('id');
      $table->string('job_number', 100)->comment('工单号');
      $table->string('repair_time', 30)->comment('报修时间');
      $table->unsignedSmallInteger('vehicle_id')->comment('车辆信息ID');
      $table->unsignedSmallInteger('repair_type_id')->comment('维修类别');
      $table->unsignedSmallInteger('mileage')->comment('车辆里程');
      $table->unsignedSmallInteger('picker_people_id')->comment('接车人');
      $table->boolean('maintain')->default(false)->comment('是否保养 1是 0否');
      $table->string('maintain_time', 30)->nullable()->comment('下次保养时间');
      $table->unsignedSmallInteger('maintain_mileage')->nullable()->comment('下次保养里程');
      $table->string('predict_complete_time', 30)->comment('预计完工日期');
      $table->text('msg')->comment('备注信息');
      $table->boolean('is_finish')->default(false)->comment('是否竣工');
      $table->boolean('is_pay')->default(false)->comment('是否结算');
      $table->string('total')->comment('结算金额');
      $table->timestamps();
    });
  }

  /**
   * Reverse the migrations.
   *
   * @return void
   */
  public function down()
  {
    Schema::dropIfExists('repair_bills');
  }
}
